Electronic devices often include sensors. For example, an optical proximity sensor may be used in a device such as a cellular telephone to monitor for the presence of a user's head adjacent to the cellular telephone. The optical proximity sensor may have an infrared light-emitting diode that emits infrared light and an infrared light detector that measures a portion of the emitted light that has been reflected back towards the infrared light detector from nearby objects.
It can be challenging to form a satisfactory optical proximity sensor for an electronic device. If care is not taken, light that is emitted by an optical proximity sensor may be reflected from static portions of the electronic device in which the optical proximity sensor system is being used rather than external objects. These static reflected signals represent a source of noise and can make it difficult to gather accurate optical proximity sensor measurements.